package com.example.demo.mapper;

import com.example.demo.entity.req.AddDeptRes;
import com.example.demo.entity.req.UpdateDpetRes;
import com.example.demo.entity.table.Dep;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {
    @Select("select * from dept")
    List<Dep> getAllDepts();

    @Delete("delete from dept where id=#{id}")
    int deleteDeptById(int id);

    @Insert("insert into dept(name,create_time,update_time) values(#{name},#{createTime},#{updateTime})")
    int addDept(AddDeptRes apr);

    @Select("select * from dept where id=#{id}")
    Dep getDeptById(Integer id);

    @Update("update dept set name=#{name} where id=#{id}")
    int updateDept(UpdateDpetRes udp);
}
